home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / 8bit / cislib_b / semfor.doc < prev    next >
Text File  |  1995-04-22  |  8KB  |  146 lines

  1. Semaphore 
  2. ANTIC, DEC 1988           Pg. 37  
  3.  
  4. By Howie Wishart 
  5. (With a listing in BASIC, SEMAFOR.BAS) 
  6.      BY HOWIE WISHART
  7.      (synopsis)
  8.      Can't find anybody to send you semaphore flag messages for reading
  9. practice?  Your Atari can be an expert signalman instructor.  This BASIC program
  10. works on all 8-bit Atari computers of any memory size, with disk or cassette.
  11.      Although Morse Code training programs are fairly common, I have never seen
  12. a program for practicing semaphore flag code.  As a former signalman in the
  13. Canadian Navy, I taught semaphore communications aboard ship and in classrooms. 
  14. And when I bought my original Atari 800XL in 1985, a primitive version of this
  15. program was my first serious attempt at programming.
  16.  
  17.      Semaphore is a means of line-of-sight communication dating from the early
  18. 1800s.  It's easy to learn.  No special equipment is required.  But operators
  19. usually hold small flags when sending during daytime, while flashlight wands are
  20. used at night.  Semaphore is still a common system of short-range communications
  21. today.  It is also of interest to cadet organizations, scouts and others.
  22.  
  23.      SEMAPHORE INTRO
  24.  
  25.      The basic technique of semaphore is to hold each arm at one of eight
  26. possible angles -- straight up, straight down, left, right, or one of the
  27. diagonals.  The various arm position combinations represent the 26 letters of
  28. the English alphabet.
  29.      Note that what you send is the reverse
  30.      of what you see.  The man in the picture sends the letter B with his right
  31. hand, and you would send a B with your right hand.  Swing your arms from letter
  32. to letter to spell words.  Hold both arms down and crossed in front of you to
  33. signal the space between words.  Rhythm and accurate angles are important.
  34.  
  35.      Numbers are spelled out.  Punctuation symbols are sent using the same
  36. combinations of letters as Morse Code.  See below:
  37.  
  38.      Period AAA
  39.      Comma MIM
  40.      Question mark IMI
  41.      Hyphen DU
  42.      Slant or fraction bar XE
  43.      Colon OS
  44.      Left parenthesis 
  45.      KN
  46.      Right parenthesis KK
  47.      End of message AR
  48.  
  49.      The code for Error is EEEEEEEE -- then send the misspelled word again.
  50.  
  51.      To get the other operator's attention, flap your arms up and down, like a
  52. bird.  He'll wave back when he's ready to read.  After reading your message,
  53. he'll hold his arms out horizontally to show the letter R (for Roger).  Or he'll
  54. send you a question mark if he missed it.  That's all there is to semaphore
  55. code.  After you learn the letters, it's easy -- and fun.
  56.  
  57.      Sending speed is measured in words per minute (wpm) -- 15 wpm is the
  58. minimum standard in the NATO navies.  But good operators can send and receive at
  59. over 30 wpm.  To qualify at a given speed, you must be able to read three tests
  60. in a row with two errors or less.
  61.  
  62.      THE PROGRAM
  63.  
  64.      Semaphore has three teaching features:  (1.) You can type a letter on the
  65. keyboard and see the flag code displayed;  (2.) Beginners can test on random
  66. five-letter groups;  (3.) Experienced readers can test on messages taken from
  67. memory at random.
  68.  
  69.      In each case, the transmitted letter is displayed onscreen in large
  70. Graphics 2 text.  You can choose test speeds from 10 to 30 words per minute. 
  71. After a test, you can get a printout to find out how well you did.
  72.  
  73.      The program works by making the computer think that PM$ is in
  74. Player-Missile memory instead of in the variable value table.  Thus, changing
  75. the contents of PM$ causes immediate changes in the player shapes onscreen.  You
  76. get a simple form of animation even though the players don't actually move.
  77.      Player 3 contains the image of a man, and players 0 (to his right), 2 (to
  78. his left) and 1 (in front of him) contain constantly changing data to display
  79. his arms in the various positions of the semaphore alphabet.  This same
  80. technique, using all five players lined up across the screen, could be used to
  81. teach the sign language alphabet for hearing-impaired.
  82.  
  83.      Because timing is so important, I have avoided using FOR/NEXT loops as much
  84. as possible, PEEKing and POKEing RTCLOK (memory location 20, $14) to control the
  85. length of time that each character is displayed.  This means that the program
  86. runs at the same speed in Atari BASIC as it does in BASIC XL's fast mode,
  87. without recalculating the speed logic.
  88.  
  89.      PROGRAM TAKE-APART
  90.  
  91.      Lines 50-61 load the appropriate part of PM$ with a particular flag shape. 
  92. Lines 32 65-90 call lines 50-61 as needed to build alphabet letters, each of
  93. which needs two flags.  Line 95 produces a raspberry noise in case of bad user
  94. input.  The term X=1^1^1^1 provides a suitable delay without a FOR/NEXT loop.
  95.      The routine at 1000-1110 sends tests.  RTCLOK is POKEd with the delay value
  96. D, the character is constructed and sent, while the letter is PRINTed either
  97. visibly or invisibly at the lower left of the screen.  The subroutine at line
  98. 1100 monitors RTCLOK until the necessary delay has passed, then RETURNs to erase
  99. the flags (but not the little man) and send another character.  Line 1010
  100. prevents flicker in case of two consecutive spaces.  Line 1030 sends a
  101. half-length space between double letters in a word.  Line 1080 walks the little
  102. man offscreen at the end of the test.
  103.      The routine at 2000-2110 reads the keyboard and displays the letter that
  104. was typed.  Anything outside the range A-Z is treated as a space.  As with the
  105. test routine, each character is also PRINTed at the lower left corner, either
  106. visibly or invisibly.  Pressing [ESCAPE] returns you to the menus.
  107.      The menus at 3000 and 3500 let you select your option, set up variables for
  108. visible or invisible text by POKEing COLOR0 (memory location 708, $02C4) with
  109. either 12 or 0, and calculate a D value to be POKEd into RTCLOK to control the
  110. speed.  Pre-recorded tests are READ into T$ here. Five-letter random tests are
  111. generated at lines 4000-4010. The character string NRURNRURNRUR creates the
  112. arm-flapping callup routine at the beginning of a message.
  113.  
  114.      After either a random-letter test or a preset message test is completed,
  115. the program proceeds to the Print Menu at lines 3800-3920.  A channel is opened
  116. to either the printer or the screen, as chosen by the user.  T$ is printed
  117. without wordwrap and with punctuation displayed as letter combinations.  If a
  118. screen display was selected, the program waits for a keypress.  Otherwise
  119. execution resumes with the main menu at line 3000.
  120.      Lines 5000-5080 perform the overlay of P/M memory onto T$, the variable
  121. holding the message to be sent.  These lines set up P/M graphics (double-line
  122. resolution, all players double-width) and generates a sequence of the little man
  123. walking onscreen from the left with flags at his sides, ready to send.  I used
  124. Graphics 18 to allow for the largest possible text display and to display
  125. visible instructions even if the transmitted characters are invisible.
  126.      Lines 6000-6240 initialize and fill the necessary strings.  PM$ must be the
  127. first string named and used in order for the program to work properly.  P$ and
  128. T$ are used variously to manipulate the text message.  K$ is a series of blanks
  129. used to quickly wipe out part of PM$ and so erase players 0-2 (while leaving the
  130. little man untouched in Player 3) between letters.
  131.      The preset tests commence at line 7000, with tests starting 10 program
  132. lines apart.  The program READs C to determine how many data strings follow. 
  133. Then it reads each string and adds it onto T$.  Adjust the RESTORE statement in
  134. line 3550 if you want to renumber this section.  There are currently 10 tests. 
  135. If you add more, change the *10 in line 3550 to reflect the actual number of
  136. tests in memory.
  137.  
  138.       Semaphore requires 16K to run, with the 10 existing message texts taking up
  139. about 2K.  So there is plenty of room for adding many more messages to ensure
  140. variety.
  141.  
  142.      (bio)
  143.      Thirty-two-year-old retired Canadian naval signalman Howie Wishart has been
  144. programming for three years.  This is his first publication in ANTIC.
  145.  
  146.